package com.itheima.day02.Demo02;

public class AnimalDemo {
    public static void main(String[] args) {
        //创建对象
        Animal a=new Cat();
        a.setName("加菲");
        a.setAge(5);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();

        Animal a1=new Cat("加菲",5);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
        System.out.println("---------------------");
        Animal d=new Dog();
        d.setName("大黄");
        d.setAge(9);
        System.out.println(d.getName()+","+d.getAge());
        d.eat();
        System.out.println("----------------------");
        Animal d1=new Dog("大黄",9);
        System.out.println(d1.getName()+","+d1.getAge());
        d1.eat();
    }


}
